package com.mzy.datepackage.M2022.July.eleventh.common;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;

import javax.validation.Valid;
import javax.validation.constraints.NotEmpty;
import java.util.Date;
import java.util.List;


/**
 * ip对象，可分为IPv4或IPv6，用type区分
 * */
@Data
@EqualsAndHashCode
@ApiModel(value = "IP对象")
public class Ip{

    /**
     * ip对象的唯一标识
     * */
    private String id;

    /**
     *名称
     * */
    @ApiModelProperty(value = "名称")
    private String name;
    /**
     *描述
     * */
    @ApiModelProperty(value = "描述")
    private String descr;
    /**
     * 模式：单个(single),多个(multi),范围(range)
     * */
    @ApiModelProperty(value = "模式：单个(SINGLE),多个(MULTI),范围(RANGE)")
    private IpAliasesModel modelType;
    /**
     *ip类型，ipv4/ipv6
     * */
    @ApiModelProperty(value = "IP类型：ipv4, ipv6")
    @NotEmpty(message = "IP类型不能为空")
    private String type;
    /**
     *ip集合(地址池)，可以是单个ip或ip范围
     * */
    @ApiModelProperty(value = "地址池：可以是单个ip或ip范围")
    @NotEmpty(message = "IP地址池不能为空")
    @Valid
    private List<IpInfo> info;


    @JsonProperty(access = JsonProperty.Access.READ_ONLY)
    @ApiModelProperty("创建时间")
    @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss")
    private Date createTime;



}
